package com.csvw.skr.basic.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 经销商对应关系更新帮助类,记录修改最初始状态
 * Created by Peng on 2017/7/12.
 */
@Entity
@Table(name = "csvw_skr_basic_dealer_help")
public class DealerHelp {
    @Id
    @Column(name = "pk_code", length = 20, nullable = false)
    private String code;

    /**
     * 经销商名称
     */
    @Column(name = "name", length = 50)
    private String name;

    /**
     * 经销商简称
     */
    @Column(name = "shorter", length = 20)
    private String shorter;

    /**
     * 所属大区编号
     */
    @Column(length = 20)
    private String rbo;

    /**
     * 所属商务处编号
     */
    @Column(length = 20)
    private String commercial;

    /**
     * 所属小区编号
     */
    @Column(length = 20)
    private String area;

    /**
     * 数据创建时间
     */
    private Date created;

    /**
     * 数据是否有效
     */
    @Column(nullable=false, columnDefinition="bit default 1")
    private boolean active;

    /**
     * 数据更新时间
     */
    private Date updated;


    @Column(length = 20)
    private String type;

    public DealerHelp() {
    }

    public DealerHelp(Dealer dealer ,String type) {
        this.code = dealer.getCode();
        this.name = dealer.getName();
        this.shorter = dealer.getShorter();
        this.rbo = dealer.getRbo();
        this.commercial = dealer.getCommercial();
        this.area = dealer.getArea();
        this.created = new Date();
        this.active = dealer.isActive();
        this.updated = new Date();
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShorter() {
        return shorter;
    }

    public void setShorter(String shorter) {
        this.shorter = shorter;
    }

    public String getRbo() {
        return rbo;
    }

    public void setRbo(String rbo) {
        this.rbo = rbo;
    }

    public String getCommercial() {
        return commercial;
    }

    public void setCommercial(String commercial) {
        this.commercial = commercial;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

}
